-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `cms_libsys_v1`
--

-- --------------------------------------------------------

--
-- Table structure for table `ci_sessions`
--

CREATE TABLE IF NOT EXISTS `ci_sessions` (
  `id` varchar(128) NOT NULL,
  `ip_address` varchar(45) NOT NULL,
  `timestamp` varchar(100) NOT NULL,
  `data` blob NOT NULL,
  PRIMARY KEY (`id`,`ip_address`),
  KEY `ci_sessions_timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `cms_book`
--

CREATE TABLE IF NOT EXISTS `cms_book` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_isbn` text NOT NULL,
  `book_banner` text,
  `book_name` text,
  `book_summary` text,
  `book_author` text,
  `book_contributor` text,
  `book_publisher` text,
  `book_quantity` int(11) NOT NULL,
  `type` text NOT NULL,
  `book_meta` text,
  `book_status` int(1) NOT NULL DEFAULT '0',
  `publish_date` date DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `username` text,
  `last_user_id` int(11) NOT NULL,
  `last_username` text,
  `status` int(2) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_book`
--

INSERT INTO `cms_book` (`id`, `book_isbn`, `book_banner`, `book_name`, `book_summary`, `book_author`, `book_contributor`, `book_publisher`, `book_quantity`, `type`, `book_meta`, `book_status`, `publish_date`, `user_id`, `username`, `last_user_id`, `last_username`, `status`, `date_added`, `last_update`) VALUES
(1, '12345', '7HYyyTwADOf7Ffh.jpg', 'qqq', NULL, 'update author', 'update contributor', 'ttt', 3, 'insert', 'a:16:{s:9:\"book_isbn\";s:5:\"12345\";s:9:\"book_name\";s:3:\"qqq\";s:12:\"book_summary\";N;s:13:\"book_quantity\";s:1:\"3\";s:11:\"book_author\";s:13:\"update author\";s:16:\"book_contributor\";s:18:\"update contributor\";s:14:\"book_publisher\";s:3:\"ttt\";s:12:\"publish_date\";s:10:\"2022-10-05\";s:11:\"book_status\";i:0;s:6:\"status\";i:1;s:4:\"type\";s:6:\"insert\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";s:11:\"book_banner\";s:19:\"7HYyyTwADOf7Ffh.jpg\";}', 0, '2022-10-05', 2, 'valentine', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-06 07:53:47'),
(2, '12346', 'yknfhumkBPOXaPD.jpeg', '111', NULL, 'qqq', 'www', '1q', 8, 'insert', 'a:16:{s:9:\"book_isbn\";s:5:\"12346\";s:9:\"book_name\";s:3:\"111\";s:12:\"book_summary\";N;s:13:\"book_quantity\";s:1:\"8\";s:11:\"book_author\";s:3:\"qqq\";s:16:\"book_contributor\";s:3:\"www\";s:14:\"book_publisher\";s:2:\"1q\";s:12:\"publish_date\";N;s:11:\"book_status\";i:0;s:6:\"status\";i:1;s:4:\"type\";s:6:\"insert\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";s:11:\"book_banner\";s:20:\"yknfhumkBPOXaPD.jpeg\";}', 0, NULL, 2, 'valentine', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-06 07:56:24'),
(3, '12347', NULL, '222', 'ddd', 'aaa', 'qqq', '2w', 76, 'import', 'a:15:{s:9:\"book_isbn\";i:12347;s:9:\"book_name\";i:222;s:12:\"book_summary\";s:3:\"ddd\";s:13:\"book_quantity\";i:76;s:11:\"book_author\";s:3:\"aaa\";s:16:\"book_contributor\";s:3:\"qqq\";s:14:\"book_publisher\";s:2:\"2w\";s:12:\"publish_date\";s:9:\"10/7/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-06 06:34:00'),
(4, '12348', NULL, '444', 'xxx', 'zzz', 'aaa', '3e', 45, 'import', 'a:15:{s:9:\"book_isbn\";i:12348;s:9:\"book_name\";i:444;s:12:\"book_summary\";s:3:\"xxx\";s:13:\"book_quantity\";i:45;s:11:\"book_author\";s:3:\"zzz\";s:16:\"book_contributor\";s:3:\"aaa\";s:14:\"book_publisher\";s:2:\"3e\";s:12:\"publish_date\";s:9:\"10/8/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-06 06:33:55'),
(5, '12349', NULL, '333', 'ccc', 'zzz', 'ttt', '4r', 1, 'import', 'a:15:{s:9:\"book_isbn\";i:12349;s:9:\"book_name\";i:333;s:12:\"book_summary\";s:3:\"ccc\";s:13:\"book_quantity\";i:1;s:11:\"book_author\";s:3:\"zzz\";s:16:\"book_contributor\";s:3:\"ttt\";s:14:\"book_publisher\";s:2:\"4r\";s:12:\"publish_date\";s:9:\"10/9/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-06 06:33:35');

-- --------------------------------------------------------

--
-- Table structure for table `cms_book_catelog`
--

CREATE TABLE IF NOT EXISTS `cms_book_catelog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_id` int(11) NOT NULL,
  `categlog_name` text,
  `catelog_summary` text,
  `catelog_file` text NOT NULL,
  `catelog_file_type` text NOT NULL,
  `catelog_status` int(2) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `cms_book_edition`
--

CREATE TABLE IF NOT EXISTS `cms_book_edition` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_id` int(11) NOT NULL,
  `book_old_meta` text NOT NULL,
  `book_new_meta` text NOT NULL,
  `edited_id` int(11) NOT NULL,
  `edited_username` text,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `cms_book_history`
--

CREATE TABLE IF NOT EXISTS `cms_book_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_id` int(11) NOT NULL,
  `member_id` int(11) NOT NULL,
  `member_code` int(11) NOT NULL,
  `borrow_date` date DEFAULT NULL,
  `return_date` date DEFAULT NULL,
  `extend_date` date DEFAULT NULL,
  `return_status` tinyint(1) NOT NULL DEFAULT '0',
  `extend_status` tinyint(1) NOT NULL DEFAULT '0',
  `history_meta` text,
  `history_entry` text,
  `history_status` int(2) NOT NULL DEFAULT '0',
  `prove_user_id` int(11) NOT NULL,
  `return_user_id` int(11) NOT NULL,
  `return_username` text NOT NULL,
  `prove_username` text,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `book_id` (`book_id`,`member_code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_book_history`
--

INSERT INTO `cms_book_history` (`id`, `book_id`, `member_id`, `member_code`, `borrow_date`, `return_date`, `extend_date`, `return_status`, `extend_status`, `history_meta`, `history_entry`, `history_status`, `prove_user_id`, `return_user_id`, `return_username`, `prove_username`, `date_added`, `last_update`) VALUES
(2, 3, 1, 123123, '2022-10-14', '2022-10-17', NULL, 0, 0, 'borrow_book', 'a:10:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";i:1;s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";}', 1, 2, 0, '', 'valentine', '2022-10-14 08:59:23', '2022-10-14 08:59:23'),
(3, 3, 1, 123123, '2022-10-14', '2022-10-17', NULL, 0, 0, 'borrow_book', 'a:10:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";s:1:\"1\";s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";}', 1, 2, 0, '', 'valentine', '2022-10-14 08:59:59', '2022-10-14 08:59:59');

--
-- Triggers `cms_book_history`
--
DROP TRIGGER IF EXISTS `member_history_insert`;
DELIMITER $$
CREATE TRIGGER `member_history_insert` AFTER INSERT ON `cms_book_history` FOR EACH ROW INSERT INTO cms_member_history VALUES(NULL,NEW.id,NEW.member_id,NEW.member_code,NEW.book_id,NEW.return_status, NEW.extend_status,0,NEW.history_status,NEW.date_added,NEW.last_update)
$$
DELIMITER ;
DROP TRIGGER IF EXISTS `member_history_update`;
DELIMITER $$
CREATE TRIGGER `member_history_update` AFTER UPDATE ON `cms_book_history` FOR EACH ROW UPDATE cms_member_history SET last_update = NEW.last_update, return_status=NEW.return_status,extend_status=NEW.extend_status,
status=NEW.history_status,member_id=NEW.member_id WHERE book_history_id=NEW.id
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `cms_book_import_history`
--

CREATE TABLE IF NOT EXISTS `cms_book_import_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_id` int(11) NOT NULL,
  `book_isbn` text NOT NULL,
  `book_name` text,
  `book_summary` text,
  `book_author` text,
  `book_contributor` text,
  `book_publisher` text,
  `book_quantity` int(11) NOT NULL,
  `type` text NOT NULL,
  `book_meta` text,
  `book_status` int(1) NOT NULL DEFAULT '0',
  `publish_date` date DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  `username` text,
  `status` int(2) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_book_import_history`
--

INSERT INTO `cms_book_import_history` (`id`, `book_id`, `book_isbn`, `book_name`, `book_summary`, `book_author`, `book_contributor`, `book_publisher`, `book_quantity`, `type`, `book_meta`, `book_status`, `publish_date`, `user_id`, `username`, `status`, `date_added`, `last_update`) VALUES
(1, 1, '12345', 'qqq', 'www', 'eee', 'rrr', 'ttt', 3, 'import', 'a:15:{s:9:\"book_isbn\";i:12345;s:9:\"book_name\";s:3:\"qqq\";s:12:\"book_summary\";s:3:\"www\";s:13:\"book_quantity\";i:3;s:11:\"book_author\";s:3:\"eee\";s:16:\"book_contributor\";s:3:\"rrr\";s:14:\"book_publisher\";s:3:\"ttt\";s:12:\"publish_date\";s:9:\"10/5/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-05 08:46:32'),
(2, 2, '12346', '111', 'sss', 'qqq', 'www', '1q', 8, 'import', 'a:15:{s:9:\"book_isbn\";i:12346;s:9:\"book_name\";i:111;s:12:\"book_summary\";s:3:\"sss\";s:13:\"book_quantity\";i:8;s:11:\"book_author\";s:3:\"qqq\";s:16:\"book_contributor\";s:3:\"www\";s:14:\"book_publisher\";s:2:\"1q\";s:12:\"publish_date\";s:9:\"10/6/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-05 08:46:32'),
(3, 3, '12347', '222', 'ddd', 'aaa', 'qqq', '2w', 76, 'import', 'a:15:{s:9:\"book_isbn\";i:12347;s:9:\"book_name\";i:222;s:12:\"book_summary\";s:3:\"ddd\";s:13:\"book_quantity\";i:76;s:11:\"book_author\";s:3:\"aaa\";s:16:\"book_contributor\";s:3:\"qqq\";s:14:\"book_publisher\";s:2:\"2w\";s:12:\"publish_date\";s:9:\"10/7/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-05 08:46:32'),
(4, 4, '12348', '444', 'xxx', 'zzz', 'aaa', '3e', 45, 'import', 'a:15:{s:9:\"book_isbn\";i:12348;s:9:\"book_name\";i:444;s:12:\"book_summary\";s:3:\"xxx\";s:13:\"book_quantity\";i:45;s:11:\"book_author\";s:3:\"zzz\";s:16:\"book_contributor\";s:3:\"aaa\";s:14:\"book_publisher\";s:2:\"3e\";s:12:\"publish_date\";s:9:\"10/8/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-05 08:46:32'),
(5, 5, '12349', '333', 'ccc', 'zzz', 'ttt', '4r', 1, 'import', 'a:15:{s:9:\"book_isbn\";i:12349;s:9:\"book_name\";i:333;s:12:\"book_summary\";s:3:\"ccc\";s:13:\"book_quantity\";i:1;s:11:\"book_author\";s:3:\"zzz\";s:16:\"book_contributor\";s:3:\"ttt\";s:14:\"book_publisher\";s:2:\"4r\";s:12:\"publish_date\";s:9:\"10/9/2022\";s:11:\"book_status\";i:1;s:6:\"status\";i:1;s:4:\"type\";s:6:\"import\";s:7:\"user_id\";s:1:\"2\";s:8:\"username\";s:9:\"valentine\";s:12:\"last_user_id\";s:1:\"2\";s:13:\"last_username\";s:9:\"valentine\";}', 1, '0000-00-00', 2, 'valentine', 1, '2022-10-05 08:46:32', '2022-10-05 08:46:32');

-- --------------------------------------------------------

--
-- Table structure for table `cms_log_sys_user`
--

CREATE TABLE IF NOT EXISTS `cms_log_sys_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `ip_address` varchar(20) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `cms_member`
--

CREATE TABLE IF NOT EXISTS `cms_member` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `member_code` varchar(30) NOT NULL,
  `full_name` text NOT NULL,
  `phone` text NOT NULL,
  `email` text NOT NULL,
  `home_address` text NOT NULL,
  `mail_address` text,
  `mail_same_as_home` tinyint(1) NOT NULL DEFAULT '1',
  `suspend` tinyint(1) NOT NULL,
  `status` int(11) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `member_code` (`member_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_member`
--

INSERT INTO `cms_member` (`id`, `user_id`, `member_code`, `full_name`, `phone`, `email`, `home_address`, `mail_address`, `mail_same_as_home`, `suspend`, `status`, `date_added`, `last_update`) VALUES
(1, 3, '123123', 'Valentine Chong', '01114068848', 'valentine.workshop11@gmail.com', '', NULL, 1, 0, 0, '2022-10-12 07:45:48', '2022-10-12 07:47:56');

-- --------------------------------------------------------

--
-- Table structure for table `cms_member_history`
--

CREATE TABLE IF NOT EXISTS `cms_member_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `book_history_id` int(11) NOT NULL,
  `member_id` int(11) NOT NULL,
  `member_code` text NOT NULL,
  `book_id` int(11) NOT NULL,
  `return_status` tinyint(1) NOT NULL DEFAULT '0',
  `extend_status` tinyint(1) NOT NULL DEFAULT '0',
  `extend_count` int(11) NOT NULL,
  `status` int(2) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `book_history_id` (`book_history_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_member_history`
--

INSERT INTO `cms_member_history` (`id`, `book_history_id`, `member_id`, `member_code`, `book_id`, `return_status`, `extend_status`, `extend_count`, `status`, `date_added`, `last_update`) VALUES
(2, 2, 1, '123123', 3, 0, 0, 0, 1, '2022-10-14 08:59:23', '2022-10-14 08:59:23'),
(3, 3, 1, '123123', 3, 0, 0, 0, 1, '2022-10-14 08:59:59', '2022-10-14 08:59:59');

-- --------------------------------------------------------

--
-- Table structure for table `cms_member_log`
--

CREATE TABLE IF NOT EXISTS `cms_member_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_id` int(11) NOT NULL,
  `member_code` varchar(30) NOT NULL,
  `meta` text,
  `meta_entry` text,
  `ip_address` text NOT NULL,
  `status` int(2) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_member_log`
--

INSERT INTO `cms_member_log` (`id`, `member_id`, `member_code`, `meta`, `meta_entry`, `ip_address`, `status`, `date_added`, `last_update`) VALUES
(1, 1, '123123', 'borrow_book', 'a:3:{s:7:\"message\";s:20:\"has borrow a book on\";s:5:\"prove\";s:8:\"prove by\";s:7:\"history\";a:11:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";i:1;s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";s:13:\"history_entry\";s:312:\"a:10:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";i:1;s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";}\";}}', '', 0, '2022-10-14 08:59:23', '2022-10-14 08:59:23'),
(2, 1, '123123', 'borrow_book', 'a:3:{s:7:\"message\";s:20:\"has borrow a book on\";s:5:\"prove\";s:8:\"prove by\";s:7:\"history\";a:11:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";s:1:\"1\";s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";s:13:\"history_entry\";s:316:\"a:10:{s:7:\"book_id\";s:1:\"3\";s:9:\"member_id\";s:1:\"1\";s:11:\"member_code\";s:6:\"123123\";s:11:\"borrow_date\";s:10:\"2022-10-14\";s:11:\"return_date\";s:10:\"2022-10-17\";s:13:\"return_status\";i:0;s:14:\"history_status\";i:1;s:13:\"prove_user_id\";s:1:\"2\";s:14:\"prove_username\";s:9:\"valentine\";s:12:\"history_meta\";s:11:\"borrow_book\";}\";}}', '', 0, '2022-10-14 08:59:59', '2022-10-14 08:59:59');

-- --------------------------------------------------------

--
-- Table structure for table `cms_sys_groups`
--

CREATE TABLE IF NOT EXISTS `cms_sys_groups` (
  `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  `admin_group` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(20) NOT NULL,
  `description` varchar(100) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_sys_groups`
--

INSERT INTO `cms_sys_groups` (`id`, `admin_group`, `name`, `description`, `status`) VALUES
(1, 1, 'admin', 'Administrator', 1),
(2, 0, 'members', 'General User', 1);

-- --------------------------------------------------------

--
-- Table structure for table `cms_sys_login_attempts`
--

CREATE TABLE IF NOT EXISTS `cms_sys_login_attempts` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `ip_address` varchar(45) NOT NULL,
  `login` varchar(100) NOT NULL,
  `time` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `cms_sys_users_groups`
--

CREATE TABLE IF NOT EXISTS `cms_sys_users_groups` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` int(11) UNSIGNED NOT NULL,
  `group_id` mediumint(8) UNSIGNED NOT NULL,
  `member_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uc_users_groups` (`user_id`,`group_id`),
  KEY `fk_users_groups_users1_idx` (`user_id`),
  KEY `fk_users_groups_groups1_idx` (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `cms_sys_users_groups`
--

INSERT INTO `cms_sys_users_groups` (`id`, `user_id`, `group_id`, `member_id`) VALUES
(1, 1, 1, NULL),
(2, 2, 1, NULL),
(3, 3, 2, 1);

--
-- Constraints for dumped tables
--

--
-- Constraints for table `cms_member_history`
--
ALTER TABLE `cms_member_history`
  ADD CONSTRAINT `book_history_id` FOREIGN KEY (`book_history_id`) REFERENCES `cms_book_history` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

